package com.briup.facade.logging;

import com.briup.common.web.SecurityUtil;
import com.briup.logging.entity.LoggingAccessInfo;
import com.briup.logging.resolver.LoggingDetailHandler;
import org.springframework.stereotype.Component;

/**
 * @author wood
 */
@Component
public class MyLoggingDetailHandler implements LoggingDetailHandler {
    /**
     * 设置日志信息，只需要设置这三项即可，其他的在日志系统中已经完成了自动赋值
     *  - setUserId
     *  - setUsername
     *  - setRealname
     */
    @Override
    public void loggingUserDeltail(LoggingAccessInfo loggingAccessInfo) {
        loggingAccessInfo.setUserId(SecurityUtil.getUserId());
        loggingAccessInfo.setUsername(SecurityUtil.getUsername());
        loggingAccessInfo.setRealname(SecurityUtil.getRealname());
    }
}
